package com.sanhuo.security.dao;

import com.sanhuo.security.bo.UserUpdateBO;
import com.sanhuo.security.dao.provider.UserProvider;
import com.sanhuo.security.entity.User;
import com.sanhuo.triild.Basic.BaseMapper;
import com.sanhuo.triild.annotation.Mapper;
import com.sanhuo.triild.annotation.Select;
import com.sanhuo.triild.annotation.Update;
import com.sanhuo.triild.annotation.UpdateProvider;
import com.sanhuo.triild.page.Page;
import com.sanhuo.triild.page.PageSearch;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Update("update user set phone=#{phone},email=#{email} where id = #{id}")
    void updateInfo(User user);

    @Update("update user set password = #{password} where id = #{id}")
    void updatePassword(User user);

    @Select("SELECT ID from user ")
    List<String> findIds();

    @Select("select count(*) from user")
    Integer findIdsNum();

    @Select("select * from user")
    Page<User> listAll(PageSearch pageSearch);

    @UpdateProvider(type = UserProvider.class, method = "update")
    void update(UserUpdateBO bo);

}
